﻿using System;
using EasyStep.Attributes;
using EasyStep.TestExecution.Data;
using EasyStep.TestExecution.Interfaces;
using OpenQA.Selenium;
using EasyStep.TestActions.Utils; 

namespace EasyStep.TestActions.Actions.RandomFill
{
    [TestAction(typeof(RandomFill), Name = "ById")]
    class RandomFillById : ITestAction<IWebDriver>
    {
        public void Execute(IWebDriver browser, TestStepResult data, IExecuteDataContext context)
        {
            browser.FindElement(By.Id(data.Locator)).Clear();
            browser.FindElement(By.Id(data.Locator)).SendKeys(ActionUtils.RandomString(data.Data));
        }
    }
}